-- Accumulates a histogram of the values in array 'arr'. Parameters 'lo' and 'hi' give the range of interest. Parameter nbins tell how many bins to divide the range into.
-- histogram() returns the number of points that fell within the range.
-- Global variable 'bins' is set to the histogram array.
-- Global variable 'mean' is set to the mean of values within the range.